package com.teradyne.merlin2.ui.client.activities;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.teradyne.merlin2.ui.client.places.QuoteEntryPlace;
import com.teradyne.merlin2.ui.client.places.QuoteHistoryPlace;
import com.teradyne.merlin2.ui.client.places.QuoteListPlace;
import com.teradyne.merlin2.ui.client.views.QuoteMenuView;

public class QuoteMenuActivity extends AbstractActivity implements
		QuoteMenuView.Presenter, ActivityCustom {

	private final QuoteMenuView view;
	private final PlaceController placeController;
	private Place place;

	public QuoteMenuActivity(QuoteMenuView view, PlaceController placeController) {
		this.view = view;
		this.placeController = placeController;
	}

	@Override
	public void start(final AcceptsOneWidget container, final EventBus eventBus) {
		container.setWidget(view.asWidget());
		view.setPresenter(QuoteMenuActivity.this);
	}

	@Override
	public void onQuoteListClicked() {
		placeController.goTo(new QuoteListPlace());
	}

	@Override
	public void onQuoteEntryClicked() {
		placeController.goTo(new QuoteEntryPlace());
	}

	@Override
	public void onQuoteHistoryClicked() {
		placeController.goTo(new QuoteHistoryPlace());
	}

	@Override
	public void setPlace(Place place) {
		this.place = place;
	}

	@Override
	public Place getPlace() {
		return place;
	}

}